package lab03;
import org.apache.commons.dbcp.BasicDataSource;


import java.sql.Connection;
import java.sql.SQLException;

public class DBCPDatasource {
    private static BasicDataSource basicDataSource = new BasicDataSource();

    static {
        basicDataSource.setUrl(ID.URL);
        basicDataSource.setUsername(ID.USERNAME);
        basicDataSource.setPassword(ID.PASSWORD);

    }
    public static Connection getConnection(){
        try {
            return basicDataSource.getConnection();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}